package com.xijia.wuyouwallet.pref;


import com.xijia.wuyouwallet.config.AppConfig;

/**
 * Created by Administrator on 2017/7/31 0031.
 */

public class PrefFactory {

    public static BasePref get(String preference){
        if (AppConfig.PreferenceModule.WALLET_PREF_DEFAULT.equals(preference)){
            return new ZcDefaultPref();
        }else if(AppConfig.PreferenceModule.WALLET_PREF_USER.equals(preference)){
            return new ZcUserPref();
        } else {
            throw new IllegalArgumentException(
                    "illegal argument, no such preference!");
        }
    }

    public static ZcDefaultPref getDefaultPref(){
        return (ZcDefaultPref) get(AppConfig.PreferenceModule.WALLET_PREF_DEFAULT);
    }

    public static ZcUserPref getUserPref() {
        return (ZcUserPref) get(AppConfig.PreferenceModule.WALLET_PREF_USER);
    }


}
